# s = ""
# print(len(s))
# s = "oo ppp     s"
# print(len(s))
# p = s.split(" ")
# print(p)


# LCR181:字符串中的单词反转
def reverseMessage(self, message):
    """
    :type message: str
    :rtype: str
    """
    str = message.split(" ")

    tmp = []
    for s in str:
        if len(s) != 0:
            tmp.append(s)
    tmp.reverse()
    ret = " ".join(tmp)
    return ret


print(reverseMessage("", "  hello world!  "))



'''
旋转字符串
'''

# join方法
# s2 = ["123","456","789","",""]
# s2.reverse()
# print("$%^".join(s2))

class Solution(object):
    def rotateString(self, s, goal):
        """
        :type s: str
        :type goal: str
        :rtype: bool
        """
        sz = len(s)
        s += s
        for i in range(0, sz):
            if s[i:i + sz] == goal:
                return True

        return False


